package com.nnxy.service.impl;
import com.nnxy.mapper.ReportMapper;
import com.nnxy.pojo.JobOption;
import com.nnxy.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class ReportServiceImpl implements ReportService {
    @Autowired
    private ReportMapper reportMapper;
    @Override
    public JobOption getEmpJobData() {
        List<Map> jobDataList = reportMapper.countEmpJobData();

        // 组装数据 JobOption
        List jobList = jobDataList.stream().map(map -> {
            return map.get("pos");
        }).toList();

        List dataList = jobDataList.stream().map(map -> {
            return map.get("num");
        }).toList();
        return new JobOption(jobList, dataList);
    }

    @Override
    public List<Map> getEmpGenderData() {
        return reportMapper.countEmpGenderData();
    }
}
